random-access-storage
Abstract interface to implement random-access instances.
Why?
This module forms a shared interface for reading and writing bytes to
different backends. By having a shared interface, it means implementations
can easily be swapped, depending on the environment.
Usage
extern crate random_access_storage;
use random_access_storage::{Sync, SyncMethods};
struct S;
impl SyncMethods for S {
type Error = std::io::Error;
fn open(&self) -> Result<(), Self::Error> {
unimplemented!();
}
fn write(&self, offset: u64, data: &[u8]) -> Result<(), Self::Error> {
unimplemented!();
}
fn read(&self, offset: u64, length: u64) -> Result<Vec<u8>, Self::Error> {
unimplemented!();
}
fn del(&self, offset: u64, length: u64) -> Result<(), Self::Error> {
unimplemented!();
}
}
let _file = Sync::new(S);
Installation
$ cargo add random-access-storage
See Also
License
MIT OR Apache-2.0